package com.htjc.integral.common.util;

import java.io.UnsupportedEncodingException;

import org.apache.commons.codec.binary.Base64;

public class EncryptUtils {
	/**
	 * base64加密
	 */
	public static String encodeDataBase64(String inputData) {
		try {
			if (null == inputData) {
				return null;
			}
			return new String(Base64.encodeBase64(inputData.getBytes("utf-8")), "utf-8");
		} catch (UnsupportedEncodingException e) {
			// logger.error(inputData, e);
		}

		return null;
	}

	/**
	 * base64解码
	 */
	public static String decodeDataBase64(String inputData) {
		try {
			if (null == inputData) {
				return null;
			}
			return new String(Base64.decodeBase64(inputData.getBytes("utf-8")), "utf-8");
		} catch (UnsupportedEncodingException e) {
			// logger.error(inputData, e);
		}

		return null;
	}
}
